//
// Created by 罗外林 on 2024/1/1.
//

#ifndef MY_APPLICATION_BLPROGRAM_H
#define MY_APPLICATION_BLPROGRAM_H

#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <string.h>
#include <vector>
#include <iostream>

class BLProgram {
public:
    BLProgram(const char *vShaderString, const char *fShaderString);
    void use();
    bool link();
    GLuint uniformIndex(std::string uniformName);
    GLuint attributeIndex(std::string attributeName);
    void addAttribute(std::string attributeName);

private:
    std::vector<std::string> attributes;
    GLuint program;
    GLuint vertShader;
    GLuint fragShader;

private:
    bool complileShader(GLuint *shader, GLenum type, std::string shaderString);
};


#endif //MY_APPLICATION_BLPROGRAM_H
